<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!--md5-->
</head>
<body>

<form action="#" method="post">
    <p>
        <span>用户名：</span>
        <input type="text" id="username">
    </p>
    <p>
        <span>密码：</span>
        <input type="password" id="password">
    </p>

    <button type="submit" onclick="login()">登录</button>
</form>

<script>
    function login(){
        var user = document.getElementById("username");
        var pwd = document.getElementById("password");

        console.log(user);
        console.log(pwd);

    }
</script>
</body>
</html>